cmake_minimum_required (VERSION 3.10)
project(QtOpenglDemo1)

#macro
add_definitions(-DUNICODE -D_UNICODE)

# compile features
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)

# import Qt
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# 开启Qt代码自动生成，不再需用自己手写了。按顺序，分别是`Q_OBJECT`宏展开，资源文件，界面文件。
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# 使用Qt的模块
set(QT Core Widgets)
find_package(Qt5 COMPONENTS REQUIRED ${QT})

# 简单粗暴的把源码搜集起来。按顺序，分别是实现文件，头文件，界面文件，资源文件
file(GLOB_RECURSE SOURCES "*.cpp")
file(GLOB_RECURSE HEADERS "*.h")
file(GLOB_RECURSE FORMS "*.ui")
file(GLOB_RECURSE RESOURCES "*.qrc")

# copy files
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vertexshader.vert ${CMAKE_CURRENT_BINARY_DIR}/vertexshader.vert)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fragmentshader.frag ${CMAKE_CURRENT_BINARY_DIR}/fragmentshader.frag)

#
# MeRobotSmallMain
#
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${FORMS} ${RESOURCES}
    )
# 链接Qt需要的库
qt5_use_modules(${PROJECT_NAME} ${QT})
#target_link_libraries(${PROJECT_NAME} log4qt winusb setupapi)
